package com.ymt.order.service.impl;

import com.ymt.order.dao.OrderMapper;
import com.ymt.producer.domain.Order;
import com.ymt.producer.service.BusinessProducerConfirmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service(value = "orderServiceReliableMessage")
public class OrderServiceReliableMessageImpl extends AbstractOrderService implements BusinessProducerConfirmService {
    @Autowired
    private OrderMapper orderMapper;

    @Override
    protected Long addPayOrder(Order order) {
        orderMapper.insert(order);
        return order.getId();
    }

    @Override
    public boolean confirm(String data) {
        Long count = orderMapper.countByOrderCode(data);
        return count > 0 ? true : false;
    }
}
